﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Array_operator
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = { 5, 56, 8, 11, 17, 69, 82, 110, 74, 6, 98, 35, 46, 51,15 };
            Console.WriteLine("This array's max is " + arrayMax(a));
            Console.WriteLine("This array's min is " + arrayMin(a));
            Console.WriteLine("This array's sum is " + arraySum(a));
            Console.WriteLine("This array's average is " + arrayAverage(a));

            Console.ReadKey();
        }
        public static int arrayMax(int[] a)
        {
            int max = a[0];
            for(int i = 1; i < a.Length; i++)
            {
                if (a[i] > max)
                    max = a[i];
            }
            return max;
        }
        public static int arrayMin(int[] a)
        {
            int min = a[0];
            for (int i = 1; i < a.Length; i++)
            {
                if (a[i] < min)
                    min = a[i];
            }
            return min;
        }
        public static double arraySum(int[] a)
        {
            double sum = 0;
            for(int i = 0; i < a.Length; i++)
            {
                sum += a[i];
            }
            return sum;
        }
        public static double arrayAverage(int[] a)
        {
            double sum=arraySum(a);
            return sum/a.Length;
        }
    }
}
